/*
    Copyright Nicolas Ronvel 2007
	gulix33xp@yahoo.fr

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

using System;
using System.Drawing;

using SdlDotNet.Graphics;

using BlindShark.Widgets;

namespace BlindShark
{
	public class Language : IListObject
	{
		string _sFilename;
		string _sDescription;
		string _sNotAskAnymore;
		
		#region Accessors
		public string Filename
		{
			get {return _sFilename;}
		}
		
		public string Description
		{
			get {return _sDescription;}
		}
		
		public string NotAskAnymoreText
		{
			get {return _sNotAskAnymore;}
		}
		
		public string ID
		{
			get {return _sFilename.Substring(0, _sFilename.LastIndexOf('.'));}
		}
		#endregion
		
		
		public Language(string filename)
		{
			_sFilename = filename;
			LanguageManager.Language = ID;
			_sDescription = LanguageManager.Get("DESC");
			_sNotAskAnymore = LanguageManager.Get("NO_ASK");
		}
		
		#region IListObject interface members
		public Surface GetSurface(Size size)
		{
			// Initializing the background
			Surface sfTemp = new Surface(size);
			sfTemp.Fill(Color.Black);
			sfTemp.Fill(new Rectangle(1,1,size.Width-2, size.Height-2), Color.Goldenrod	);
			// Initializing the text
			Label lblText = new Label(_sDescription, 14, Color.Black, TextAlignment.CenterMiddle);
			lblText.Size = sfTemp.Size;
			lblText.Location = new Point(0,0);
			lblText.Init();
			sfTemp.Blit(lblText.Surface, lblText.Location);
			return sfTemp;
		}
		
		public Surface GetSurfaceSelected(Size size)
		{
			// Initializing the background
			Surface sfTemp = new Surface(size);
			sfTemp.Fill(Color.Black);
			sfTemp.Fill(new Rectangle(1,1,size.Width-2, size.Height-2), Color.Sienna);
			// Initializing the text
			Label lblText = new Label(_sDescription, 14, Color.Black, TextAlignment.CenterMiddle);
			lblText.Size = sfTemp.Size;
			lblText.Location = new Point(0,0);
			lblText.Init();
			sfTemp.Blit(lblText.Surface, lblText.Location);
			return sfTemp;
		}
		
		public Surface GetSurfaceHovered(Size size)
		{
			// Initializing the background
			Surface sfTemp = new Surface(size);
			sfTemp.Fill(Color.Black);
			sfTemp.Fill(new Rectangle(1,1,size.Width-2, size.Height-2), Color.Chocolate);
			// Initializing the text
			Label lblText = new Label(_sDescription, 14, Color.Black, TextAlignment.CenterMiddle);
			lblText.Size = sfTemp.Size;
			lblText.Location = new Point(0,0);
			lblText.Init();
			sfTemp.Blit(lblText.Surface, lblText.Location);
			return sfTemp;
		}
		#endregion
	}
}
